﻿//  --------------------------------
//  Copyright (c) AW Systems, Inc. All rights reserved.
//  This source code is made available under the terms of the Microsoft Public License (Ms-PL)
//  http://www.codeplex.com/SLAM/license
//  ---------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Slam.Configuration
{
	/// <summary>
	/// Represents a definition for the ID used by a type managed by SLAM.
	/// </summary>
	public class TypeIdDefinition
	{
		/// <summary>
		/// Indicates whether this ID is a Primary Key.
		/// </summary>
		public bool IsPrimaryKey { get; set; }

		/// <summary>
		/// The name of the ID definition.
		/// </summary>
		public string Name { get; set; }

		/// <summary>
		/// The format used for the name of the ID column.  This format can include the token {TypeName}.
		/// </summary>
		public string NameFormat { get; set; }

		/// <summary>
		/// Indicates whether the ID column defined accompanies the standard SharePoint IDs, ListItemID, ListRelativeID,
		/// and ListID.  If ReplaceSharePointIds is true then the three standard SharePoint IDs are not managed by
		/// SLAM.
		/// </summary>
		public bool ReplaceSharePointIds { get; set; }

		/// <summary>
		/// The SQL datatype for the ID column.
		/// </summary>
		public string SqlType { get; set; }

		/// <summary>
		/// The format used to generate the value of the ID.
		/// </summary>
		public TypeIdDefinitionValueFormat ValueFormat { get; set; }

		/// <summary>
		/// A prefix to be prepended to the value of the ID.
		/// </summary>
		public string ValuePrefix { get; set; }

		/// <summary>
		/// A suffix to be appended to the value of the ID.
		/// </summary>
		public string ValueSuffix{ get; set; }

		/// <summary>
		/// Creates a new TypeIdDefinition instance.
		/// </summary>
		public TypeIdDefinition() { }
	}

	/// <summary>
	/// Represents possible TypeIdDefinition ValueFormat values.
	/// </summary>
	public enum TypeIdDefinitionValueFormat
	{
		Custom,
		Guid,
		Hex,
		Int
	}
}
